package transfer

import (
	"context"
	"data-transfer/global"
	"data-transfer/plugins"
	"github.com/go-mysql-org/go-mysql/canal"
	"go.uber.org/zap"
)

func MonitorDataChange(handler canal.EventHandler, canalStore plugins.DB, firstRunFlag string) error {
	c := context.Background()
	err := canalStore.MonitorDataChange(c, handler, firstRunFlag)
	if err != nil {
		global.LOG.Fatal("数据同步失败！", zap.Any("err", err))
		return err
	}
	return nil
}
